package com.freestyle.sentinel;


import com.freestyle.common.ResponseEntity;

/**
 * Created by rocklee on 2022/3/31 17:07
 */
public class SentinelResponseEntity<T> extends ResponseEntity<T> {
  public void setMethod(MethodArgs methodArgs){
    put("method",methodArgs);
  }
  public MethodArgs getMethod(){
     return get("method");
  }
  public static <T> SentinelResponseEntity<T> fromErr(long id, int errCode, String message) {
    SentinelResponseEntity<T> ret = new SentinelResponseEntity();
    ret.setId(id);
    ret.setErrCode(errCode);
    ret.setMessage(message);
    return ret;
  }
  public static <V> SentinelResponseEntity<V> fromResult(long id, V val) {
    SentinelResponseEntity<V> ret = new SentinelResponseEntity<>();
    ret.setResult(val);
    ret.setId(id);
    ret.setErrCode(0);
    return ret;
  }

}
